package com.huiztech.kaoqinji.mvc;

import com.huiztech.kaoqinji.R;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;

public class MyView {

    private Activity currentActivity;
    private ProgressDialog progressDialog;
    private AlertDialog.Builder alertDialogBuider;

    public MyView(Activity activity) {
        this.currentActivity = activity;
    }

    public void setCurrentActivity(Activity activity) {
        this.currentActivity = activity;
    }

    public Activity getCurrentActivity() {
        return this.currentActivity;
    }

    public void showBusy() {
        if (this.currentActivity.isFinishing()) {
            return;
        }
        if (progressDialog == null) {
            String msg = this.currentActivity.getResources().getString(R.string.LoadingMessage);
            progressDialog = ProgressDialog.show(this.currentActivity, null, msg, true, true);
        } else {
            progressDialog.show();
        }
    }

    public void hideBusy() {
        if (progressDialog != null && progressDialog.isShowing()) {
            progressDialog.dismiss();
        }
    }

}
